package com.atguigu.cloudalibaba.controller;


import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;



import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

/**
 * @auther zzyy
 * @create 2020-01-09 16:34
 */
@RestController
public class FlowLimitController
{

    @GetMapping("/testA")
    public String testA()
    {
//        TimeUnit.MILLISECONDS.sleep();
        return "------testA";
    }

    @GetMapping("/testB")
    public String testB()
    {
        return "------testB";
    }

    @GetMapping("/testE")
    @SentinelResource(value = "testE",blockHandler ="dealHandler_testE")
    public  String KeytestE(@RequestParam(value = "p1",required = false)String p1,
                            @RequestParam(value = "p2",required = false ) String p2){
        return  "tetsE success";
    }

    public  String dealHandler_testE(String p1, String p2, BlockException exception){

        return  "tetsE success  hahaha!";


    }


}
 
 
